#!/bin/bash

#sudo modprobe -v dummy numdummies=1

if [ -z "$(sed -n '/dummy/p' /etc/modules)" ]
then

#sudo sed -i 's/^dummy.*//' /etc/modules

sudo sh -c "echo '
dummy
' >> /etc/modules"
fi

#if [ -z "$(sed -n '/auto dummy0/p' /etc/network/interfaces)" ]
#then

sh -c "echo '

auto dummy0

iface dummy0 inet manual
  pre-up /sbin/ip link add $IFACE type dummy
  post-down /sbin/ip link delete $IFACE

iface dummy0 inet static
  address 10.126.253.1
  netmask 255.255.255.0
' > /etc/network/interfaces.d/dummy0"

sh -c "echo '

auto dummy1

iface dummy1 inet manual
  pre-up /sbin/ip link add $IFACE type dummy
  post-down /sbin/ip link delete $IFACE

iface dummy1 inet static
  address 10.126.252.1
  netmask 255.255.255.0
' > /etc/network/interfaces.d/dummy1"

#fi

